<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">
</head>
<body>
<div class="layui-container">
    <div class="layui-row">
        <div class="" style="height: 55px;"></div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md3">
            <img src="../static/img/44.jpg" alt="" width="100%;">
        </div>
        <div class="layui-col-md9">
            <div class="" style="height: 177px;"></div>
            <div class="" style="text-align: center;width: 333px;margin: 0 auto;">
                <h1>医生后台登陆系统</h1>
                <hr>
                <form class="layui-form" lay-filter="form1">
                    <div class="layui-form-item">
                        <input type="text" name="account" placeholder="请输入账号" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <input type="password" name="password" placeholder="请输入密码" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <button class="layui-btn" type="button" style="width: 99px;" onclick="login()">登陆</button>
                        <button class="layui-btn" type="button" style="width: 77px;" onclick="register()">注册</button>
                        <button class="layui-btn layui-bg-gray" type="reset" style="width: 77px;">重置</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <hr>
    </div>
    <div class="layui-row" style="text-align: center">
        <p>版权所有：四川大学华西医院&nbsp;&nbsp;&nbsp;&nbsp;地址：四川省成都市武侯区国学巷37号</p>
        <p>联系电话：+86 150777853261&nbsp;&nbsp;EMAIL：200645049@qq.com&nbsp;&nbsp;邮编：10010</p>
    </div>
</div>
</body>
<script type="text/javascript" src="../static/layui/layui.all.js"></script>
<script type="text/javascript" src="../static/config.js"></script>
<script type="text/javascript">
    const $ = layui.$;
    const layer = layui.layer;
    const form = layui.form;

    function login() {
        const form1 = form.val("form1");
        console.log(form1);
        $.post({
            url: baseUrl + "/hospital-doctor/doctor/login",
            dataType: "json",
            data: form1,
            success: function (res) {
                if (res.data) {
                    layer.msg("登陆成功，正在跳转后台...");
                    localStorage.setItem("x-token", res.msg);
                    setInterval(function () {
                        location.href = "index.html";
                    }, 1500);
                } else {
                    layer.msg(res.msg);
                }
            }
        });
    }

    function register() {
        layer.open({
            type: 2,
            content: 'frame/register.html',
            area: ['400px', '444px'],
            title: '注册'
        });
    }


</script>
</html>